import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.Socket;
import java.io.DataOutputStream;;



public class TCPClient {

	public static void main(String[] args) throws Exception{
		BufferedReader inFromUse = new BufferedReader(new InputStreamReader(System.in));
		Socket clientSocket = new Socket("localhost",9999);
		DataOutputStream outToServer = new DataOutputStream(clientSocket.getOutputStream());
		BufferedReader inFromServer = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
		System.out.print("nhap vao chuoi gui cho Server");
		String gui = inFromUse.readLine();
		outToServer.writeBytes(gui + '\n');
		String nhan = inFromServer.readLine();
		System.out.println("Tu Server: " + nhan);
		clientSocket.close();
		// TODO Auto-generated method stub

	}

}
